package com.schoolcafeteria.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.schoolcafeteria.security.UserDetailsImpl;



@Controller
@RequestMapping("/account")

public class AccountController {

	@PreAuthorize("hasAuthority('COMMON')")
	@RequestMapping("/modify")
	public String modify(Model model){
		UserDetailsImpl impl= (UserDetailsImpl) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		model.addAttribute("loginuser", impl);
		return "account-modify";
	}
	
	@RequestMapping("/deny")
	public String deny(){
		return "account-deny";
	}
	
	@RequestMapping("/login")
	public String login(){
		return "account-login";
	}
}
